home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
A.C.E. 3
/
ACE CD 3.iso
/
files
/
utils
/
aplay200.lha
/
APlayer
/
Files
/
Developer.lha
/
Examples
/
LibraryStartup.S
< prev
Wrap
Text File
|
1995-12-23
|
4KB
|
185 lines
; $VER: xx.library 1.0
;
INCDIR "Includes3.0:Include3.0/"
INCLUDE "Exec/Types.i"
INCLUDE "Own/SystemBases.i"
INCLUDE "Own/SystemStructures.i"
INCLUDE "Own/SystemOffsets.i"
INCLUDE "Own/AccessiblePlayer.i"
VERSION = 1
REVISION = 0
TRUE = -1
FALSE = 0
; Library Data
LN_Name = 10
LN_Type = 8
NT_Library = 9
LIBB_Summing = 0
LIBB_Changed = 1
LIBB_SumUsed = 2
LIBB_DelExp = 3
LIBF_Summing = 1<<LIBB_Summing
LIBF_Changed = 1<<LIBB_Changed
LIBF_SumUsed = 1<<LIBB_SumUsed
LIBF_DelExp = 1<<LIBB_DelExp
; Macros
INBYTE MACRO
dc.b %11100000,0
dc.w \1
dc.b \2,0
ENDM
INWORD MACRO
dc.b %11010000,0
dc.w \1,\2
ENDM
INLONG MACRO
dc.b %11000000,0
dc.w \1
dc.l \2
ENDM
; Library Base Structure
STRUCTURE LibraryStruct,0
STRUCT LIB_Node,14
UBYTE LIB_Flags
UBYTE LIB_Pad
UWORD LIB_NegSize
UWORD LIB_PosSize
UWORD LIB_Version
UWORD LIB_Revision
APTR LIB_IDString
ULONG LIB_Sum
UWORD LIB_OpenCnt
LONG LIB_SegList
LABEL LibraryStruct_SIZEOF
SECTION xx.library,CODE
START moveq #0,d0
rts
;------------------------------------------------------------------------------
LIBNAME dc.b "apxx.library",0
LIBID dc.b "xx.library 1.0 (02-February-1995)",0
even
;------------------------------------------------------------------------------
; ROMTAG Structure
;
ROMTAG dc.w $4afc ;ROMTAG Indentifier
dc.l romtag
dc.l slut
dc.b $80 ;Flags
dc.b version
dc.b $09 ;Type Of Module
dc.b $00 ;Initialization Priority
dc.l libname
dc.l libid
dc.l autinit ;Pointer To AUTOINIT Table
;------------------------------------------------------------------------------
; AUTOINIT Table
;
AUTINIT dc.l LibraryStruct_SIZEOF ;Size Of Structure AFTER Base Address
dc.l vector ;Pointer To Vector Table
dc.l inittab ;Pointer To Init Structure
dc.l init ;Pointer To Init Routine
;------------------------------------------------------------------------------
; Init Table
;
INITTAB INBYTE LN_Type,NT_Library
INBYTE LIB_Flags,LIBF_SumUsed!LIBF_Changed
INWORD LIB_Version,version
INWORD LIB_Revision,revision
INLONG LN_Name,libname
INLONG LIB_IDString,libid
dc.l 0
;------------------------------------------------------------------------------
; Vector Table
;
VECTOR dc.w -1
dc.w opnlib-vector,clslib-vector,expunge-vector,extfunc-vector
dc.w xx_GetTags-vector
dc.w -1
;------------------------------------------------------------------------------
; Init Routine
;
INIT movem.l d1-d7/a0-a6,-(sp)
move.l d0,a4 ;Base Address
move.l a0,LIB_SegList(a4)
move.l a4,d0
movem.l (sp)+,d1-d7/a0-a6
rts
;------------------------------------------------------------------------------
; Offset -6: Open Library
;
OPNLIB addq.w #1,LIB_OpenCnt(a6)
bclr #LIBB_DelExp,LIB_Flags(a6)
move.l a6,d0
rts
;------------------------------------------------------------------------------
; Offset -12: Close Library
;
CLSLIB moveq #0,d0
subq.w #1,LIB_OpenCnt(a6)
bne.b clslibo
btst #LIBB_DelExp,LIB_Flags(a6)
bne.b expunge
CLSLIBO rts
;------------------------------------------------------------------------------
; Offset -18: Expunge
;
EXPUNGE movem.l d1-d7/a0-a6,-(sp)
move.l a6,a4
tst.w LIB_OpenCnt(a4)
beq.b exp1
bset #LIBB_DelExp,LIB_Flags(a4)
moveq #0,d0
bra.b expungo
EXP1 move.l 4.w,a6
move.l LIB_SegList(a4),d2
move.l a4,a1
jsr Remove(a6)
move.l a4,a1
moveq #0,d0
move.w LIB_NegSize(a4),d0
sub.l d0,a1
add.w LIB_PosSize(a4),d0
jsr FreeMem(a6)
move.l d2,d0
EXPUNGO movem.l (sp)+,d1-d7/a0-a6
rts
;------------------------------------------------------------------------------
; Offset -24: ExtFunc
;
EXTFUNC moveq #0,d0
rts
;------------------------------------------------------------------------------
SLUT